package com.hcloud.libupload.utils

import java.io.File
import java.io.RandomAccessFile

class File2Body {


    @Synchronized
    fun file2Body(file: File, seek: Long, partSize: Int): ByteArray {

        val partContent = ByteArray(partSize)
        val randomAccessFile = RandomAccessFile(file, "r")
        randomAccessFile.seek(seek)
        randomAccessFile.readFully(partContent, 0, partSize)

        randomAccessFile.close()

        return partContent
    }

}